package org

import "time"

type Org struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	TenantID  uint      `json:"tenant_id" gorm:"index"`
	Name      string    `json:"name" gorm:"size:100"`
	ParentID  uint      `json:"parent_id" gorm:"index"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (Org) TableName() string {
	return "org"
}

type OrgDepartment struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	TenantID  uint      `json:"tenant_id" gorm:"index"`
	OrgID     uint      `json:"org_id" gorm:"index"`
	Name      string    `json:"name" gorm:"size:100"`
	ParentID  uint      `json:"parent_id" gorm:"index"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (OrgDepartment) TableName() string {
	return "org_department"
}

type OrgMember struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	TenantID  uint      `json:"tenant_id" gorm:"index"`
	OrgID     uint      `json:"org_id" gorm:"index"`
	OrgDeptID uint      `json:"org_dept_id" gorm:"index"`
	UserID    uint      `json:"user_id" gorm:"index"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (OrgMember) TableName() string {
	return "org_member"
}
